package com.lovo.test.ScissorsGame;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * 玩家类
 */
public class Player extends Role {
    @Override
    public void scissors() {

        Scanner scan = new Scanner(System.in);


        System.out.println("请输入数字:1.石头   2. 剪刀   3. 布");

        while (true) {
            try {
                int number = scan.nextInt();
                if (number <= 3 && number >= 1) {
                    this.setNumber(number);
                    break;
                } else {
                    System.out.println("请输入正确的数字");
                }

            } catch (InputMismatchException e) {
                System.out.println("请输入正确的数字");
                scan.next();
            }


        }

    }
}
